package com.yq.core.util;

import com.yq.core.comm.Constants;
import com.yq.core.dto.BaseDO;
import com.yq.core.dto.UserDO;
import org.springframework.util.StringUtils;

import java.util.Calendar;
import java.util.Date;

/**
 * Created by yq on 16-8-7.
 */
public class DOUtil {

    /**
     * 补全用户信息
     * */
    public static void completeUserDateInfo(BaseDO baseDO){
        if(baseDO == null){
            return;
        }
        if(StringUtils.isEmpty(baseDO.getActiveFlag())){
            baseDO.setActiveFlag(Constants.Y_FLAG);
        }
        Date date = Calendar.getInstance().getTime();
        if(baseDO.getCreateTime() == null){
            baseDO.setCreateTime(date);
        }
        if(baseDO.getUpdateTime() == null){
            baseDO.setUpdateTime(date);
        }
    }
}
